layui.use(['layer', 'jquery', 'table'], function () {

    const layer = layui.layer
        , $ = layui.jquery
        , table = layui.table
        , form = layui.form;

    //第一个实例
    table.render({
        elem: '#dataTab'
        , id: 'positionDataTable'
        , height: 500
        , url: '/position/list/' //数据接口
        , method: 'POST'
        , where: getWhere()
        , response: {
            "statusName": "status",
            "statusCode": 200
        }
        , contentType: "application/x-www-form-urlencoded"
        , cols: [[ //表头
            {field: "_numbers", title: "序号", type: "numbers", fixed: 'left'}
            , {field: 'id', title: 'ID', width: '5%'}
            , {field: 'companyName', title: '公司', width: '12%'}
            , {field: 'createTime', title: '创建时间', width: '15%'}
            , {field: 'city', title: '城市', width: '6%'}
            , {field: 'positionName', title: '职位名称', width: '15%'}
            , {field: 'salary', title: '薪资范围', width: '8%'}
            , {field: 'positionAdvantage', title: '职位福利'}
        ]]
    });

    function getWhere() {
        const where = {};
        where.positionName = $('#positionName').val();
        return where;
    }

    $('#searchBtn').bind('click', function () {
        table.reload('positionDataTable', {"where": getWhere()});
    })

})